#!/usr/bin/php
<?php
/**
 * Apricot cli script 
 *
 * @package Apricot
 */

/** Require initialization (setup.php) */
require 'setup.php';

// Mark as in a terminal
$cfg['output'] = 'term';

// Apricot Base singleton instance
$_BASE = Apricot_Base::get_instance();
$_BASE->set_config($cfg);

// Setup and initialize ArgV object
require_once 'Qi/Console/ArgV.php';
$args = new Qi_Console_ArgV(
    $argv,
    array(
        'arg:action' => 'index',
        'arg:params' => '',
    )
);

$controller_action = array(
    'controller' => $_BASE->get_config_setting('cli_controller'),
    'action'     => $args->action,
    'params'     => $args->params,
);

$r = new Qi_Request($controller_action, 'get');

$_BASE->dispatch($r);
